import java.util.Random;

public class test81 {
    public static void main(String[] args) {
        //先创建一个一维数组
        int[] tempArr ={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
        Random r = new Random();
        for (int i = 0; i < tempArr.length; i++) {
            int index = r.nextInt(tempArr.length);
            int temp = tempArr[i];
            tempArr[i] = tempArr[index];
            tempArr[index] = temp;
        }
        for (int i = 0; i < tempArr.length; i++) {
            System.out.print(tempArr[i]+" ");
        }
        System.out.println();
        //创建一个二维数组
        int[][] date = new int[4][4];
        int index = 0;
        for (int i = 0; i < date.length; i++) {
            for (int j = 0; j < date[i].length; j++) {
                date[i][j] = tempArr[index];
                index++;
            }
        }
        //遍历并打印二维数组
        for (int i = 0; i < date.length; i++) {
            for (int j = 0; j < date[i].length; j++) {
                System.out.print(date[i][j]+" ");
            }
            System.out.println();
        }
        }
    }

